#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
#include <QLabel>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    ui->pushButton_sub->setToolTip("降低窗口透明度");
    ui->pushButton_add->setToolTip("增加窗口透明度");



    QPixmap pixmap(":/1.jpg");
    pixmap = pixmap.scaled(25,25);
    QCursor cursor(pixmap);
    ui->pushButton->setCursor(cursor);
//    QCursor cursor(Qt::WaitCursor);
//    ui->pushButton->setCursor(cursor);


    QLabel *label = new QLabel(this);
    label->setText("一段文字");

    QFont font;
    font.setFamily("微软雅黑");
    font.setPixelSize(30);

    label->setFont(font);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_sub_clicked()
{
    float opacity = this->windowOpacity();
    if(opacity <= 0)
        return;
    qDebug() << opacity;
    opacity -=0.1;
    this->setWindowOpacity(opacity);
}

void Widget::on_pushButton_add_clicked()
{
    float opacity = this->windowOpacity();
    if(opacity >= 1.0)
        return;
    qDebug() << opacity;
    opacity +=0.1;
    this->setWindowOpacity(opacity);
}
